package com.googlecode.gwtbb.client.only.widget.form;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Abraham Grief
 * @version $Id$
 * @since Jul 20, 2008
 */
public class CompleteProcessListenerCollection {
	private List<CompleteProcessListener> completeProcessListeners;

	public void addCompleteProcessListener(CompleteProcessListener listener) {
		if (completeProcessListeners == null)
			completeProcessListeners = new ArrayList<CompleteProcessListener>(1);
		completeProcessListeners.add(listener);
	}

	public void fireCompleteProcessEvent(ProcessEvent processEvent) {
		if (completeProcessListeners != null)
			for (CompleteProcessListener completeProcessListener : completeProcessListeners)
				completeProcessListener.onProcessCompletion(processEvent);
	}

	public void removeCompleteProcessListener(CompleteProcessListener completeProcessListener) {
		if (completeProcessListener != null)
			completeProcessListeners.remove(completeProcessListener);
	}
}
